package cn.iocoder.yudao.module.written.exam.dal.mysql.userwrittenexamrecordsdetail;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.written.exam.controller.app.userwrittenexamrecordsdetail.vo.AppUserWrittenExamRecordsDetailGroupRespVO;
import cn.iocoder.yudao.module.written.exam.dal.dataobject.userwrittenexamrecordsdetail.UserWrittenExamRecordsDetailDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.written.exam.controller.admin.userwrittenexamrecordsdetail.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 笔试记录详情 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserWrittenExamRecordsDetailMapper extends BaseMapperX<UserWrittenExamRecordsDetailDO> {

    default PageResult<UserWrittenExamRecordsDetailDO> selectPage(UserWrittenExamRecordsDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserWrittenExamRecordsDetailDO>()
                .betweenIfPresent(UserWrittenExamRecordsDetailDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getRecordsId, reqVO.getRecordsId())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getMessageId, reqVO.getMessageId())
                .likeIfPresent(UserWrittenExamRecordsDetailDO::getFileIds, reqVO.getFileIds())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getExamType, reqVO.getExamType())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getJobCategoriesId, reqVO.getJobCategoriesId())
                .likeIfPresent(UserWrittenExamRecordsDetailDO::getJobCategoriesName, reqVO.getJobCategoriesName())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getExpertId, reqVO.getExpertId())
                .likeIfPresent(UserWrittenExamRecordsDetailDO::getExpertName, reqVO.getExpertName())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getConsumedPoints, reqVO.getConsumedPoints())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getQuestionType, reqVO.getQuestionType())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getFileUrls, reqVO.getFileUrls())
                .eqIfPresent(UserWrittenExamRecordsDetailDO::getQuestionAnswer, reqVO.getQuestionAnswer())
                .orderByAsc(UserWrittenExamRecordsDetailDO::getId));
    }

    List<AppUserWrittenExamRecordsDetailGroupRespVO> groupByRecordsId(@Param("recordsIds") List<Long> recordsIds);

}